package file.listener.observer.impl;

import file.FileFrame;
import file.listener.FileFrameAbstract;
import file.listener.observer.TreeObserver;
import file.model.FileModel;

import javax.swing.*;
import java.awt.*;

/**
 * Jlable监听事件
 * @Author: zou
 * @email: 704572528@qq.com
 * @Date: 2020/10/29 13:14
 */
public class JLabelPathImpl extends FileFrameAbstract implements TreeObserver {


    public JLabelPathImpl(FileFrame fileFrame) {
        super(fileFrame);
    }


    /**
     * 左子树被点中了 更新路径
     * @param fileModel
     */
    @Override
    public void choickNode(FileModel fileModel) {
        if (fileModel == null) {
            return;
        }
        JLabel pathLable = fileFrame.getPathLable();
        pathLable.setText(fileModel.getPath());
    }
}
